home *** CD-ROM | disk | FTP | other *** search
- /*****
- $VER: RecentScript Commands 1.7 (14.3.98) ©Arndt van der Molen
-
-
- RecentScript Commands
-
- is a MUIRexx subapplication and can not be started directly.
-
- It is called only from the starter application.
- *****/
-
-
-
- /* Change to path with trailing ':' or '/' where this script resides */
- srcdir = 'MUIREXX:RecentScript/'
-
-
- /* !!! NOTHING TO CHANGE BELOW THIS LINE !!! */
-
- MUIV_List_Select_Off = '0'
- MUIV_List_Select_On = '1'
-
- OPTIONS RESULTS
-
- PARSE ARG portname cmd1 cmd2 '['cmd3']'
- cmd2 = STRIP(cmd2)
-
- PRAGMA('Directory',srcdir) /* Set current directory */
-
- ADDRESS VALUE portname
-
- IF ~SHOW('l', "rexxdossupport.library") THEN DO
- IF ~ADDLIB('rexxdossupport.library',0,-30,0) THEN DO
- request ID RECSCRWIN TITLE '"Library Error"' GADGETS '"_OK"' STRING "Could not load 'rexxdossupport.library'"
- RETURN
- END
- END
-
- SELECT
- WHEN cmd1 = 'ADD' THEN CALL addentries
- WHEN cmd1 = 'CLR' THEN CALL clearlist cmd2
- WHEN cmd1 = 'SAL' THEN CALL selectlist cmd2
- WHEN cmd1 = 'TGL' THEN CALL togglelist cmd2
- WHEN cmd1 = 'DAL' THEN CALL deselectlist cmd2
- WHEN cmd1 = 'DEL' THEN CALL delentry
- WHEN cmd1 = 'LOAD' THEN CALL loadindex cmd2 cmd3
- WHEN cmd1 = 'MINUS' THEN CALL patternentries MUIV_List_Select_Off
- WHEN cmd1 = 'PLUS' THEN CALL patternentries MUIV_List_Select_On
- WHEN cmd1 = 'SAVE' THEN CALL savelist
- WHEN cmd1 = 'SETBAT' THEN CALL batchsettingopen '['cmd3']'
- WHEN cmd1 = 'SETBATHDL' THEN CALL batchsettinghandle cmd2 '['cmd3']'
- WHEN cmd1 = 'LOADCFG' THEN CALL loadconfig
- WHEN cmd1 = 'SAVECFG' THEN CALL saveconfig
- WHEN cmd1 = 'SORT' THEN CALL sortlist cmd2 cmd3
- WHEN cmd1 = 'TEST' THEN CALL testprocedure cmd2
- WHEN cmd1 = 'SETFLT' THEN CALL filtersettingopen
- WHEN cmd1 = 'SETFLTHDL' THEN CALL filtersettinghandle cmd2 '['cmd3']'
- WHEN cmd1 = 'ABOUT' THEN CALL about
-
- OTHERWISE DO
- request ID RECSCRWIN TITLE '"Internal Error"' GADGETS '"_OK"' STRING 'Unsupport command "'cmd1 cmd2 cmd3'"'
- END
- END
-
- RETURN
-
-
-
- /* --------------------------------------------------------- */
- /* Add all selected entries from the LST_ALL to the LST_SEL */
- /* --------------------------------------------------------- */
-
- addentries: PROCEDURE
-
- MUIA_List_Quiet = '0x8042d8c7'
- MUIA_List_Entries = '0x80421654'
- MUIM_Busy_Move = '0x80020001'
- MUIM_List_Jump = '0x8042baab'
- MUIV_List_Insert_Bottom = -3
-
-
- /* Disable both listviews for speedup */
- list ID LST_ALL ATTRS MUIA_List_Quiet 1
- list ID LST_SEL ATTRS MUIA_List_Quiet 1
-
- DO FOREVER
-
- list ID LST_ALL
- line = RESULT
-
- IF line = '' THEN LEAVE
-
- /* Remove (Most Downloaded/Top Rated) style from line */
- IF SUBSTR(line,40,1) = '' THEN line = SUBSTR(line,1,39) || SUBSTR(line,42)
-
- method ID CLS_BUSY MUIM_Busy_Move
-
- list ID LST_SEL ATTRS MUIA_List_Entries
- oldentries = RESULT
-
- /* Add entry if it is not a duplicate */
- list ID LST_SEL NODUP POS MUIV_List_Insert_Bottom INSERT STRING line
-
- list ID LST_SEL ATTRS MUIA_List_Entries
- newentries = RESULT
-
- /* Check if number of entries has changed */
- IF newentries > oldentries
- THEN DO
-
- /* Update entry counter */
- text ID SFILES LABEL RIGHT(newentries, 5, '0')
-
- /* This line must be edited if the format of the index file changes */
- PARSE VAR line WITH 31 size +4
-
- /* get kb counter */
- text ID SKB
- kByte = RESULT
-
- SELECT
- WHEN RIGHT(size,1) = 'K' THEN kByte = kByte + LEFT(size,3)
- WHEN RIGHT(size,1) = 'M' THEN kByte = kByte + TRUNC((LEFT(size,3) * 1024) + 0.5)
- END
-
- /* Update kb counter */
- text ID SKB LABEL RIGHT(kByte, 6, '0')
- END
-
- END
-
- /* Enable both listviews for input again */
- list ID LST_ALL ATTRS MUIA_List_Quiet 0
- list ID LST_SEL ATTRS MUIA_List_Quiet 0
-
- RETURN
-
-
-
- /* --------------------------------------------------------- */
- /* Delete selected entry from the LST_SEL */
- /* --------------------------------------------------------- */
-
- delentry: PROCEDURE
-
- MUIA_List_Active = '0x8042391c'
- MUIA_List_Entries = '0x80421654'
- MUIM_Busy_Move = '0x80020001'
-
-
- method ID CLS_BUSY MUIM_Busy_Move
-
- /* Get position to delete */
- list ID LST_SEL ATTRS MUIA_List_Active
- position = RESULT
-
-
- /* Get line content to delete */
- list ID LST_SEL POS position
- line = RESULT
-
-
- /* Delete line in list */
- list ID LST_SEL POS position STRING
-
-
- /* Update counters */
- list ID LST_SEL ATTRS MUIA_List_Entries
- newentries = RESULT
- text ID SFILES LABEL RIGHT(newentries, 5, '0')
-
- text ID SKB
- kByte = RESULT
-
- /* This line must be edited if the format of the index file changes */
- PARSE VAR line WITH 31 size +4
-
- SELECT
- WHEN RIGHT(size,1) = 'K' THEN kByte = kByte - LEFT(size,3)
- WHEN RIGHT(size,1) = 'M' THEN kByte = kByte - TRUNC((LEFT(size,3) * 1024) + 0.5)
- END
-
- text ID SKB LABEL RIGHT(kByte, 6, '0')
-
- RETURN
-
-
-
- /* --------------------------------------------------------- */
- /* Load specified AmiNet index file into specified listview */
- /* --------------------------------------------------------- */
-
- loadindex: PROCEDURE EXPOSE srcdir portname
-
- parse arg listid ' ' filename
-
- MUIA_List_Quiet = '0x8042d8c7'
- MUIA_List_Entries = '0x80421654'
- MUIA_Menuitem_Checked = '0x8042562a'
- MUIM_Busy_Move = '0x80020001'
- ASLFR_InitialDrawer = '0x80080009'
- MUIV_List_Insert_Bottom = -3
-
-
-
- IF filename = '' THEN DO
-
- IF listid = 'LST_ALL' THEN DO
- cycle ID CYC_ALL
- END
- ELSE DO
- cycle ID CYC_SEL
- END
- loadmode = RESULT
-
- IF loadmode = 'File' THEN DO
-
- /* Get filename via requestor */
-
- OPTIONS FAILAT 11
- aslrequest ID RECSCRWIN TITLE '"Load AmiNet index file..."' ATTRS ASLFR_InitialDrawer srcdir
- returncode = RC
- filename = RESULT
- OPTIONS FAILAT 10
-
- IF returncode ~= 0 | filename = '' THEN DO
- RETURN
- END
- END
- ELSE DO
-
- /* Get filename via Importer */
-
- CALL PRAGMA('Directory', srcdir || "Importers")
-
- importercall = 'CALL 'loadmode portname
- interpret importercall
- filename = RESULT
-
- CALL PRAGMA('Directory',srcdir)
-
- IF filename = 'RESULT' THEN DO
- RETURN
- END
- END
- END
-
-
- /* Exclude non-interest directories via AminetFilter? */
- item ID MEN_AMF ATTRS MUIA_Menuitem_Checked
- filter = RESULT
- IF filter = 1 THEN DO
-
- /* Create temporary file because AminetFilter modifies the original */
- getvar AMF_TEMP
- tempfile = RESULT || FILEPART(filename)
- ADDRESS COMMAND 'copy >NIL: "'filename'" "'tempfile'"'
-
- getvar AMF_PATT
- pattern = RESULT
-
- getvar AMF_PATH
- cmd_str = RESULT || " " || tempfile || " " || pattern || " NS"
-
- ADDRESS COMMAND cmd_str
- filename = tempfile
- END
-
-
- /* Read new index file */
- IF OPEN(indexhandle, filename, 'R') THEN DO
-
- /* Append new files or clear old list? */
- list ID listid ATTRS MUIA_List_Entries
- oldentries = RESULT
-
- IF oldentries > 0 THEN DO
- request ID RECSCRWIN TITLE '"Decision..."' GADGETS '"_Yes|_No"' STRING 'Replace old list?'
-
- IF RESULT = 1 THEN DO
- CALL clearlist listid
- END
- END
-
- list ID listid ATTRS MUIA_List_Quiet 1
-
- style = ""
-
- DO UNTIL EOF(indexhandle)
-
- method ID CLS_BUSY MUIM_Busy_Move
-
- line = READLN(indexhandle)
-
-
- /* Check for introducer of "Most Downloaded" and "Top Rated" archives */
- IF SUBSTR(line,1,10) = "| The most" THEN style = "\033i"
- ELSE IF SUBSTR(line,1,10) = "| The high" THEN style = "\033b"
-
- /* Check if the line is an AmiNet Index line */
-
- slashposition = POS('/',line)
-
- /* This check must be edited if the format of the index file changes */
- IF (SUBSTR(line,34,1) = 'K' | SUBSTR(line,34,1) = 'M'),
- & SUBSTR(line,19,1) = ' ',
- & SUBSTR(line,30,1) = ' ',
- & slashposition > 20,
- & slashposition < 29
- THEN DO
-
- /* Change all comma to semicolon due to MUIRexx flaw */
- line = TRANSLATE(line, ";", ",")
-
- /* Check for AGE column and parse accordingly */
- IF DATATYPE(SUBSTR(line,36,3), 'WHOLE') = 1 & SUBSTR(line,35,1) = ' '
- THEN DO
- /* This line must be edited if the format of the index file changes */
- PARSE VAR line WITH 1 name +18 WITH 20 directory +10 WITH 31 size +4 WITH 36 age +3 WITH 40 comment
- END
- ELSE DO
- /* This line must be edited if the format of the index file changes */
- PARSE VAR line WITH 1 name +18 WITH 20 directory +10 WITH 31 size +4 WITH 36 comment
- age = " 0"
- END
-
- list ID listid ATTRS MUIA_List_Entries
- oldentries = RESULT
-
- list ID listid NODUP POS MUIV_List_Insert_Bottom INSERT STRING name","directory","size","age","style||comment
-
- list ID listid ATTRS MUIA_List_Entries
- newentries = RESULT
-
- /* Check if number of entries has changed */
- IF newentries > oldentries
- THEN DO
-
- SELECT
- WHEN RIGHT(size,1) = 'K' THEN kByte = LEFT(size,3)
- WHEN RIGHT(size,1) = 'M' THEN kByte = TRUNC((LEFT(size,3) * 1024) + 0.5)
- END
-
- IF listid = 'LST_ALL'
- THEN DO
- text ID AFILES LABEL RIGHT(newentries, 5, '0')
-
- text ID AKB
- kByte = kbyte + RESULT
- text ID AKB LABEL RIGHT(kByte, 6, '0')
- END
- ELSE DO
- text ID SFILES LABEL RIGHT(newentries, 5, '0')
-
- text ID SKB
- kByte = kbyte + RESULT
- text ID SKB LABEL RIGHT(kByte, 6, '0')
- END
- END
- END
- END
-
- list ID listid ATTRS MUIA_List_Quiet 0
-
- CALL CLOSE(indexhandle)
-
- IF filter = 1 THEN DO
- ADDRESS COMMAND 'delete >NIL: "'tempfile'"'
- END
-
- END
- ELSE DO
- request ID RECSCRWIN TITLE '"File Error"' GADGETS "_OK" STRING "Cannot read file '"filename"'"
- END
-
- RETURN
-
-
-
- /* --------------------------------------------------------- */
- /* Save LST_SEL to AmiNet index file or user defined batch */
- /* --------------------------------------------------------- */
-
- savelist: PROCEDURE EXPOSE srcdir
-
- MUIA_List_Entries = '0x80421654'
- MUIA_Menuitem_Checked = '0x8042562a'
- MUIM_Busy_Move = '0x80020001'
- ASLFR_InitialFile = '0x80080008'
- ASLFR_InitialDrawer = '0x80080009'
-
-
- /* Get batchmode */
-
- cycle ID CYC_BAT
- batchmode = RESULT
-
- /* Save to AmiNet Index file ? */
-
- IF batchmode = 'AmiNet Index' THEN DO
- CALL saveasindex
- RETURN
- END
-
- /* A user defined batchmode is selected... */
-
- /* Read batchmode settings in local stem */
-
- IF loadbatchsetting('['batchmode']') = 1 THEN DO
-
- IF batchcfg.exec ~= 'Always' THEN DO
-
- locdir = PATHPART(batchcfg.file)
- locfile = FILEPART(batchcfg.file)
-
- IF locdir = "" THEN locdir = srcdir
-
- OPTIONS FAILAT 11
- aslrequest ID RECSCRWIN TITLE '"Save 'batchmode' file..."' ATTRS ASLFR_InitialDrawer locdir ASLFR_InitialFile locfile
- returncode = RC
- outputfilename = RESULT
- OPTIONS FAILAT 10
-
- IF returncode ~= 0 | outputfilename = '' THEN DO
- RETURN
- END
- END
- ELSE DO
- outputfilename = batchcfg.file
- END
-
-
- IF OPEN(writehandle, outputfilename, 'W') THEN DO
-
- /* Read and Write batchmode intro file if available */
-
- filename = srcdir || "Configs/" || batchmode || ".intro"
-
- IF OPEN(handle, filename, 'R') THEN DO
-
- /* Do for all lines in file */
- DO UNTIL EOF(handle)
-
- method ID CLS_BUSY MUIM_Busy_Move
-
- line = READLN(handle)
-
- /* Replace batch placeholders with value from config */
- DO i=1 TO (batchvar.0)
-
- /* Replace all placeholders in line */
- start = POS(batchvar.i.replace, line)
- DO WHILE start ~= 0
-
- line = SUBSTR(line,1,start-1) || SUBSTR(line,start+2)
- line = INSERT(batchvar.i.val, line, start-1)
- start = POS(batchvar.i.replace, line)
- END
-
- END
-
- CALL WRITELN(writehandle, line)
- END
-
- CALL CLOSE(handle)
- END
-
-
- /* Read and Write batchmode entry file if available */
-
- filename = srcdir || "Configs/" || batchmode || ".entry"
-
- IF OPEN(handle, filename, 'R') THEN DO
-
- /* Add entry placeholders to local stem varaible */
- i = batchvar.0 + 1
- batchvar.i.replace = '%n' /* name */
- i = i+1
- batchvar.i.replace = '%N' /* name+ */
- i = i+1
- batchvar.i.replace = '%d' /* directory */
- i = i+1
- batchvar.i.replace = '%D' /* directory+ */
- i = i+1
- batchvar.i.replace = '%s' /* size */
- i = i+1
- batchvar.i.replace = '%S' /* size+ */
- i = i+1
- batchvar.i.replace = '%a' /* age */
- i = i+1
- batchvar.i.replace = '%A' /* age+ */
- i = i+1
- batchvar.i.replace = '%c' /* comment */
- i = i+1
- batchvar.i.replace = '%C' /* comment+ */
- batchvar.0 = i
-
- /* Read batchmode entry lines in local stem variable */
-
- entrycfg.0 = 0
- i = 1
-
- DO UNTIL EOF(handle)
-
- method ID CLS_BUSY MUIM_Busy_Move
-
- entrycfg.i = READLN(handle)
- entrycfg.0 = i
- i = i + 1
- END
-
- CALL CLOSE(handle)
-
- /* Do for all entries in LST_SEL */
-
- list ID LST_SEL ATTRS MUIA_List_Entries
- lstselcount = RESULT
-
- IF lstselcount > 0 THEN DO
-
- DO lstselnr=0 TO lstselcount-1
-
- method ID CLS_BUSY MUIM_Busy_Move
-
- list ID LST_SEL POS lstselnr
- listline = RESULT
-
- /* This line must be edited if the format of the index file changes */
- PARSE VAR listline WITH 1 name +18 WITH 20 directory +10 WITH 31 size +4 WITH 36 age +3 WITH 40 comment +44
-
- /* Add entry values to local stem variable */
- i = batchvar.0 + 1 - 10
-
- batchvar.i.val = STRIP(name)
- i = i+1
- batchvar.i.val = name
- i = i+1
- batchvar.i.val = STRIP(directory)
- i = i+1
- batchvar.i.val = directory
- i = i+1
- batchvar.i.val = STRIP(size)
- i = i+1
- batchvar.i.val = size
- i = i+1
- batchvar.i.val = STRIP(age)
- i = i+1
- batchvar.i.val = age
- i = i+1
- batchvar.i.val = comment
- i = i+1
- batchvar.i.val = SUBSTR(comment, 1, 44, ' ')
-
-
- DO global=0 TO batchcfg.readme /* Process *.readme file ? */
-
- IF global=1 THEN DO
-
- i = batchvar.0 - 4 /* Set new 'size' to 0 */
- batchvar.i.val = ' 0K'
-
- i = batchvar.0 - 5 /* Set new 'size+' to 0 */
- batchvar.i.val = '0K'
-
- i = batchvar.0 - 9 /* Set new 'name' to *.readme */
- position = LASTPOS('.', batchvar.i.val)
-
- IF position ~= 0 THEN DO
- batchvar.i.val = SUBSTR(batchvar.i.val, 1, position) || "readme"
- END
- ELSE DO
- batchvar.i.val = batchvar.i.val || ".readme"
- END
-
- j = batchvar.0 - 8 /* Set new 'name+' to *.readme */
- batchvar.j.val = SUBSTR(batchvar.i.val, 1, 18, ' ');
- END
-
- /* Do for all entry config lines */
-
- DO entrycfgnr=1 TO entrycfg.0
-
- line = entrycfg.entrycfgnr
-
- /* Replace batch and entry placeholders with value from config */
- DO i=1 TO batchvar.0
-
- /* Replace all placeholders in line */
- start = POS(batchvar.i.replace, line)
- DO WHILE start ~= 0
-
- line = SUBSTR(line,1,start-1) || SUBSTR(line,start+2)
- line = INSERT(batchvar.i.val, line, start-1)
- start = POS(batchvar.i.replace, line)
- END
- END
-
- CALL WRITELN(writehandle, line)
- END
- END
- END
- END
- batchvar.0 = batchvar.0 - 10 /* Remove entry variables from config */
- END
-
-
- /* Read and Write batchmode extro file if available */
-
- filename = srcdir || "Configs/" || batchmode || ".extro"
-
- IF OPEN(handle, filename, 'R') THEN DO
-
- /* Do for all lines in file */
- DO UNTIL EOF(handle)
-
- method ID CLS_BUSY MUIM_Busy_Move
-
- line = READLN(handle)
-
- /* Replace batch placeholders with value from config */
- DO i=1 TO (batchvar.0)
-
- /* Replace all placeholders in line */
- start = POS(batchvar.i.replace, line)
- DO WHILE start ~= 0
-
- line = SUBSTR(line,1,start-1) || SUBSTR(line,start+2)
- line = INSERT(batchvar.i.val, line, start-1)
- start = POS(batchvar.i.replace, line)
- END
- END
-
- CALL WRITELN(writehandle, line)
- END
-
- CALL CLOSE(handle)
- END
-
- CALL CLOSE(writehandle)
-
-
- /* Copy icon for batchfile if available */
- allfiles = showdir(srcdir || 'Configs', 'f', ';')
-
- IF INDEX(allfiles, batchmode".info") ~= 0 THEN DO
- ADDRESS COMMAND 'copy >NIL: "'srcdir'Configs/'batchmode'.info" "'outputfilename'.info"'
- END
-
-
- /* Replace all filename placeholders in commandline */
- cmd_string = batchcfg.cmd
-
- start = POS("%o", cmd_string)
- DO WHILE start ~= 0
- cmd_string = SUBSTR(cmd_string,1,start-1) || SUBSTR(cmd_string,start+2)
- cmd_string = INSERT(outputfilename, cmd_string, start-1)
- start = POS("%o", cmd_string)
- END
-
-
- SELECT
-
- WHEN batchcfg.exec = 'Never' THEN DO
- END
-
- WHEN batchcfg.exec = 'Always' THEN DO
- OPTIONS FAILAT 21
- ADDRESS COMMAND cmd_string
- OPTIONS FAILAT 10
- END
-
- OTHERWISE DO
-
- request ID RECSCRWIN TITLE 'Execute?' GADGETS '_Yes|_No' STRING 'Process output via\n\n\033b'cmd_string'\033n\n\ncommand now?'
-
- IF RESULT = 1 THEN DO
- OPTIONS FAILAT 21
- ADDRESS COMMAND cmd_string
- OPTIONS FAILAT 10
- END
- END
- END
-
- END
- ELSE DO
- request ID RECSCRWIN TITLE '"File Error"' GADGETS "_OK" STRING "Cannot write file '"outputfilename"'"
- RETURN
- END
-
- /* Get 'Quit after save' setting */
- item ID MEN_QAS ATTRS MUIA_Menuitem_Checked
-
- IF RESULT = 1 THEN DO
- QUIT
- END
-
- END
- ELSE DO
- request ID RECSCRWIN TITLE '"File Error"' GADGETS '"_OK"' STRING "Cannot read '"batchmode"' configuration"
- END
-
- RETURN
-
-
-
- /* --------------------------------------------------------- */
- /* Save all entries from the LST_SEL to an AmiNet index file */
- /* --------------------------------------------------------- */
-
- saveasindex: PROCEDURE EXPOSE srcdir
-
- MUIA_List_Entries = '0x80421654'
- MUIM_Busy_Move = '0x80020001'
- ASLFR_InitialFile = '0x80080008'
- ASLFR_InitialDrawer = '0x80080009'
-
-
- OPTIONS FAILAT 11
- aslrequest ID RECSCRWIN TITLE '"Save AmiNet index file..."' ATTRS ASLFR_InitialDrawer srcdir ASLFR_InitialFile "RecentScript.lst"
- returncode = RC
- filename = RESULT
- OPTIONS FAILAT 10
-
- IF returncode = 0 & filename ~= '' THEN DO
-
- IF OPEN(handle, filename, 'W') THEN DO
-
- list ID LST_SEL ATTRS MUIA_List_Entries
- number = RESULT
-
- IF number > 0 THEN DO
-
- DO i=0 TO number-1
-
- method ID CLS_BUSY MUIM_Busy_Move
-
- list ID LST_SEL POS i
- line = RESULT
-
- /* This line must be edited if the format of the index file changes */
- PARSE VAR line WITH 1 name +18 WITH 20 directory +10 WITH 31 size +4 WITH 36 age +3 WITH 40 comment
-
- CALL WRITELN(handle,name directory size age comment)
- END
- END
-
- CALL CLOSE(handle)
- END
- ELSE DO
- request ID RECSCRWIN TITLE '"File Error"' GADGETS "_OK" STRING "'Cannot write file '"filename"'"
- END
- END
-
-
- RETURN
-
-
-
- /* --------------------------------------------------------- */
- /* Delete all entries in specified listview */
- /* --------------------------------------------------------- */
-
- clearlist: PROCEDURE
-
- parse arg listid
-
- list ID listid STRING
-
- IF listid = 'LST_ALL'
- THEN DO
- text ID AFILES LABEL RIGHT(0, 5, '0')
- text ID AKB LABEL RIGHT(0, 6, '0')
- END
- ELSE DO
- text ID SFILES LABEL RIGHT(0, 5, '0')
- text ID SKB LABEL RIGHT(0, 6, '0')
- END
-
- RETURN
-
-
-
- /* --------------------------------------------------------- */
- /* Select all entries in specified listview */
- /* --------------------------------------------------------- */
-
- selectlist: PROCEDURE
-
- parse arg listid
-
- MUIM_List_Select = '0x804252d8'
- MUIV_List_Select_All = '-2'
- MUIV_List_Select_On = '1'
-
- method ID listid MUIM_List_Select MUIV_List_Select_All MUIV_List_Select_On 0
-
- RETURN
-
-
-
- /* --------------------------------------------------------- */
- /* Toggle all entries in specified listview */
- /* --------------------------------------------------------- */
-
- togglelist: PROCEDURE
-
- parse arg listid
-
- list ID listid TOGGLE
-
- RETURN
-
-
-
- /* --------------------------------------------------------- */
- /* Deselect all entries in specified listview */
- /* --------------------------------------------------------- */
-
- deselectlist: PROCEDURE
-
- parse arg listid
-
- MUIM_List_Select = '0x804252d8'
- MUIV_List_Select_All = '-2'
- MUIV_List_Select_Off = '0'
-
- method ID listid MUIM_List_Select MUIV_List_Select_All MUIV_List_Select_Off 0
-
- RETURN
-
-
-
- /* --------------------------------------------------------- */
- /* (De)Select entries in LST_ALL with search string */
- /* --------------------------------------------------------- */
-
- patternentries: PROCEDURE
-
- parse arg mode
-
- MUIA_List_Quiet = '0x8042d8c7'
- MUIA_List_Entries = '0x80421654'
- MUIM_List_Select = '0x804252d8'
- MUIM_Busy_Move = '0x80020001'
-
- list ID LST_ALL ATTRS MUIA_List_Entries
- number = RESULT
-
- IF number > 0 THEN DO
-
- string ID STR_PATT
- pattern = UPPER(RESULT)
-
- list ID LST_ALL ATTRS MUIA_List_Quiet 1
-
- DO i=0 TO number-1
-
- method ID CLS_BUSY MUIM_Busy_Move
-
- list ID LST_ALL POS i
- line = UPPER(RESULT)
-
- IF POS(pattern, line) ~= 0 THEN DO
-
- method ID LST_ALL MUIM_List_Select i mode 0
- END
- END
-
- list ID LST_ALL ATTRS MUIA_List_Quiet 0
- END
-
- RETURN
-
-
-
- /* --------------------------------------------------------- */
- /* Opens batch settings window for the specified batchmode */
- /* --------------------------------------------------------- */
-
- batchsettingopen: PROCEDURE EXPOSE portname srcdir
-
- parse arg '['batchmode']'
-
- /* Strip '...' from batchmode string */
- batchmode = LEFT(batchmode, LENGTH(batchmode)-3)
-
-
- MUIA_Selected = '0x8042654b'
- MUIA_Weight = '0x80421d1f'
-
- /* GUI Help Bubbles */
-
- HLP_BUT_DESC = '"Shows batchmode description if available"'
- HLP_CHK_README = '"Generate additional entry for the ''.readme'' file ?"'
- HLP_ASL_FILE = '"Defines default filename for saving.\nDo NOT use Spaces!"'
- HLP_CYC_EXEC = '"Defines whether the script should\nbe started after saving"'
- HLP_ASL_CMD = '"Defines the DOS command to execute the output.\nVariable ''%o'' will be replaced by path and name of the output."'
-
- /* GUI Commands */
-
- CMD_BUT_SAVE = '"'srcdir'RecentScriptCmd 'portname' SETBATHDL SAVE ['batchmode']"'
- CMD_BUT_CANCEL = '"'srcdir'RecentScriptCmd 'portname' SETBATHDL CANCEL ['batchmode']"'
- CMD_BUT_DESC = '"'srcdir'RecentScriptCmd 'portname' SETBATHDL DESC ['batchmode']"'
-
-
- /* Read global batchmode config in local stem vraiable */
-
- IF loadbatchsetting('['batchmode']') = 1 THEN DO
-
- asdf = 'endgroup' /* Workaround for an interpreting error (?) */
-
- /* Create window */
-
- window ID BATSETWIN TITLE '"'batchmode'"' PORT portname
-
- button COMMAND CMD_BUT_DESC HELP HLP_BUT_DESC LABEL 'Description...'
-
- group FRAME LABEL 'Global'
- group HORIZ
- space HORIZ
- check ID CHK_README ATTRS MUIA_Selected batchcfg.readme HELP HLP_CHK_README
- label "Include '#?.readme'"
- space HORIZ
- endgroup
- group HORIZ
- label "Save to"
- popasl ID ASL_FILE HELP HLP_ASL_FILE CONTENT batchcfg.file
- endgroup
- group HORIZ
- cycle ID CYC_EXEC ATTRS MUIA_Weight 0 HELP HLP_CYC_EXEC LABELS 'Never,Ask,Always'
- label "execute script via"
- popasl ID ASL_CMD HELP HLP_ASL_CMD CONTENT batchcfg.cmd
- endgroup
- endgroup
-
- group FRAME LABEL 'Configuration Variables'
-
- IF batchvar.0 = 0 THEN DO
- text LABEL '\033cNo user variables defined.'
- END
- ELSE DO
-
- group SCROLL
-
- /* Create string gadgets for each user variable */
-
- DO i=1 TO batchvar.0
- group ID '"G'D2C(i+65)'"'
- label CENTER '"'batchvar.i.desc'"'
- group HORIZ
- label batchvar.i.replace
- string ID '"S'D2C(i+65)'"' HELP '"Replaces configuration variable ''%'D2C(i+48)''' in output"' CONTENT batchvar.i.val
- interpret asdf
- interpret asdf
- END i
- endgroup
- END
- endgroup
-
- group HORIZ
- button COMMAND CMD_BUT_SAVE LABEL 'Save'
- button COMMAND CMD_BUT_CANCEL LABEL 'Cancel'
- endgroup
-
- endwindow
-
- cycle ID CYC_EXEC LABELS batchcfg.exec
-
- END
- ELSE DO
- request ID RECSCRWIN TITLE '"File Error"' GADGETS '"_OK"' STRING "Cannot read '"batchmode"' configuration"
- END
-
- RETURN
-
-
-
- /* --------------------------------------------------------- */
- /* Handle buttons from the batch settings window */
- /* --------------------------------------------------------- */
-
- batchsettinghandle: PROCEDURE expose srcdir portname
-
- parse arg mode '['batchmode']'
-
- MUIM_Busy_Move = '0x80020001'
-
-
- SELECT
-
- WHEN mode = 'DESC' THEN DO
-
- window ID HELPWIN CLOSE
-
- window ID HELPWIN TITLE '"Description of '''batchmode'''"' COMMAND '"window ID HELPWIN CLOSE"' PORT portname
-
- filename = srcdir || "Configs/" || batchmode || ".hlp"
-
- IF OPEN(handle, filename, 'R') THEN DO
- view ID HELPVIEW FILE '"'filename'"'
- CALL CLOSE(handle)
- END
- ELSE DO
- view ID HELPVIEW STRING "Sorry, no help available.\n\nContact the author of the configuration to provide it..."
- END
-
- endwindow
- END
-
-
- WHEN mode = 'CANCEL' THEN DO
- window ID BATSETWIN CLOSE
- END
-
- WHEN mode = 'SAVE' THEN DO
-
- /* Save global and variable configs to file */
-
- /* Read global config for description in local stem */
-
- IF loadbatchsetting('['batchmode']') = 1 THEN DO
-
- /* Get new global config values in local stem */
-
- check ID CHK_README
- batchcfg.readme = RESULT
- popasl ID ASL_FILE
- batchcfg.file = RESULT
- cycle ID CYC_EXEC
- batchcfg.exec = RESULT
- popasl ID ASL_CMD
- batchcfg.cmd = RESULT
-
- /* Write global config to file */
-
- filename = srcdir || "Configs/" || batchmode || ".cfg"
-
- IF OPEN(handle, filename, 'W') THEN DO
- CALL WRITELN(handle, batchcfg.readme)
- CALL WRITELN(handle, batchcfg.file)
- CALL WRITELN(handle, batchcfg.exec)
- CALL WRITELN(handle, batchcfg.cmd)
- CALL CLOSE(handle)
- END
- ELSE DO
- request ID RECSCRWIN TITLE '"File Error"' GADGETS '"_OK"' STRING "Cannot write file '"filename"'"
- END
-
-
- filename = srcdir || "Configs/" || batchmode || ".var"
-
- /* Write variable batchmode config to file */
-
- IF OPEN(handle, filename, 'W') THEN DO
-
- DO i=1 TO batchvar.0
-
- method ID CLS_BUSY MUIM_Busy_Move
-
- string ID '"S'D2C(i+65)'"'
- batchvar.i.val = RESULT
-
- CALL WRITELN(handle, batchvar.i.desc)
- CALL WRITELN(handle, batchvar.i.val)
- END
-
- CALL CLOSE(handle)
- END
- ELSE DO
- request ID RECSCRWIN TITLE '"File Error"' GADGETS '"_OK"' STRING "Cannot write file '"filename"'"
- END
- END
- ELSE DO
- request ID RECSCRWIN TITLE '"File Error"' GADGETS '"_OK"' STRING "Cannot read '"batchmode"' configuration"
- END
-
- window ID BATSETWIN CLOSE
- END
-
- OTHERWISE DO
- request ID RECSCRWIN TITLE '"Internal Error"' GADGETS '"_OK"' STRING 'Unsupport command "'mode'"'
- END
- END
-
- RETURN
-
-
-
- /* --------------------------------------------------------- */
- /* Load config and variables of a batchmode setting */
- /* --------------------------------------------------------- */
-
- loadbatchsetting: PROCEDURE EXPOSE srcdir batchcfg. batchvar.
-
- parse arg '['batchmode']'
-
- /* Read global batchmode config in local stem vraiable */
-
- filename = srcdir || "Configs/" || batchmode || ".cfg"
-
- IF OPEN(handle, filename, 'R') THEN DO
-
- batchcfg.readme = READLN(handle)
- batchcfg.file = READLN(handle)
- batchcfg.exec = READLN(handle)
- batchcfg.cmd = READLN(handle)
-
- CALL CLOSE(handle)
-
-
- /* Read variable batchmode config in local stem variable */
-
- filename = srcdir || "Configs/" || batchmode || ".var"
-
- batchvar.0 = 0
-
- IF OPEN(handle, filename, 'R') THEN DO
-
- i = 0
-
- DO UNTIL EOF(handle)
-
- method ID CLS_BUSY MUIM_Busy_Move
-
- description = READLN(handle)
- value = READLN(handle)
-
- IF description ~= "" | value ~= "" THEN DO
-
- i = i + 1
- batchvar.0 = i
-
- batchvar.i.replace = '%'D2C(i+48)'' /* %1 ... */
- batchvar.i.desc = description
- batchvar.i.val = value
- END
- END
-
- CALL CLOSE(handle)
- END
-
- RETURN 1
-
- END
- ELSE DO
- request ID RECSCRWIN TITLE '"File Error"' GADGETS '"_OK"' STRING "Cannot read file '"filename"'"
- RETURN 0
- END
-
-
- /* --------------------------------------------------------- */
- /* Load RecentScript configuration */
- /* --------------------------------------------------------- */
-
- loadconfig: PROCEDURE EXPOSE srcdir
-
- MUIA_Menuitem_Checked = '0x8042562a'
-
-
- IF OPEN(readhandle, srcdir"RecentScript.cfg", 'R') THEN DO
-
- /* Get selected 'Save as' batchmode */
- line = READLN(readhandle)
- cycle ID CYC_BAT LABELS line
-
- /* Get 'Quit after save' setting */
- line = READLN(readhandle)
- item ID MEN_QAS ATTRS MUIA_Menuitem_Checked line
-
- /* Get selected AmiNet Index 'Import from' loadmode */
- line = READLN(readhandle)
- cycle ID CYC_ALL LABELS line
-
- /* Get selected Selected Files 'Import from' loadmode */
- line = READLN(readhandle)
- cycle ID CYC_SEL LABELS line
-
- /* Get 'AminetFilter Active' setting */
- line = READLN(readhandle)
- item ID MEN_AMF ATTRS MUIA_Menuitem_Checked line
-
-
- /* Get 'Aminet Filter Settings' and store in MUIRexx variables */
- setvar AMF_PATH READLN(readhandle)
- setvar AMF_TEMP READLN(readhandle)
- setvar AMF_PATT READLN(readhandle)
-
- CALL CLOSE(readhandle)
- END
-
- RETURN
-
-
-
- /* --------------------------------------------------------- */
- /* Save RecentScript configuration */
- /* --------------------------------------------------------- */
-
- saveconfig: PROCEDURE EXPOSE srcdir
-
- MUIA_Menuitem_Checked = '0x8042562a'
-
-
- IF OPEN(writehandle, srcdir"RecentScript.cfg", 'W') THEN DO
-
- cycle ID CYC_BAT
- CALL WRITELN(writehandle, RESULT)
- item ID MEN_QAS ATTRS MUIA_Menuitem_Checked
- CALL WRITELN(writehandle, RESULT)
- cycle ID CYC_ALL
- CALL WRITELN(writehandle, RESULT)
- cycle ID CYC_SEL
- CALL WRITELN(writehandle, RESULT)
- item ID MEN_AMF ATTRS MUIA_Menuitem_Checked
- CALL WRITELN(writehandle, RESULT)
- getvar AMF_PATH
- CALL WRITELN(writehandle, RESULT)
- getvar AMF_TEMP
- CALL WRITELN(writehandle, RESULT)
- getvar AMF_PATT
- CALL WRITELN(writehandle, RESULT)
-
- CALL CLOSE(writehandle)
- END
-
- RETURN
-
-
-
- /* --------------------------------------------------------- */
- /* Sorts all entries in specified listview */
- /* --------------------------------------------------------- */
-
- sortlist: PROCEDURE
-
- parse arg listid
-
- MUIM_List_Sort = '0x80422275'
-
- method ID listid MUIM_List_Sort
-
- RETURN
-
-
-
- /* --------------------------------------------------------- */
- /* Opens the AminetFilter settings window */
- /* --------------------------------------------------------- */
-
- filtersettingopen: PROCEDURE EXPOSE portname srcdir
-
-
- /* GUI Commands */
-
- CMD_BUT_OK = '"'srcdir'RecentScriptCmd 'portname' SETFLTHDL OK"'
- CMD_BUT_CANCEL = '"'srcdir'RecentScriptCmd 'portname' SETFLTHDL CANCEL"'
-
-
- window ID FLTSETWIN TITLE '"AminetFilter"' PORT portname
-
- text LABEL '\033cThe feature to filter Aminet directories\nis done by the external program\n\033bAmiNetFilter\033n by ©Marcin Orlowski\n(comm/misc/AminetFilter.lha)'
-
- group FRAME
- group
- label CENTER '"AminetFilter executable"'
- getvar AMF_PATH
- popasl ID PATH CONTENT RESULT
-
- label CENTER '"Directory for temporary file"'
- getvar AMF_TEMP
- popasl ID TEMP CONTENT RESULT
-
- label CENTER '"Directory pattern to exclude"'
- getvar AMF_PATT
- string ID PATT CONTENT RESULT
- endgroup
-
- group HORIZ
- button COMMAND CMD_BUT_OK LABEL 'Ok'
- button COMMAND CMD_BUT_CANCEL LABEL 'Cancel'
- endgroup
- endgroup
-
- endwindow
-
- RETURN
-
-
-
- /* --------------------------------------------------------- */
- /* Handle buttons from the AminetFilter settings window */
- /* --------------------------------------------------------- */
-
- filtersettinghandle: PROCEDURE expose srcdir portname
-
- parse arg mode '['batchmode']'
-
- MUIM_Busy_Move = '0x80020001'
-
-
- SELECT
-
- WHEN mode = 'CANCEL' THEN DO
- window ID FLTSETWIN CLOSE
- END
-
- WHEN mode = 'OK' THEN DO
-
- popasl ID PATH
- setvar AMF_PATH RESULT
- popasl ID TEMP
- setvar AMF_TEMP RESULT
- string ID PATT
- setvar AMF_PATT RESULT
-
- window ID FLTSETWIN CLOSE
- END
-
- OTHERWISE DO
- request ID RECSCRWIN TITLE '"Internal Error"' GADGETS '"_OK"' STRING 'Unsupport command "'mode'"'
- END
- END
-
- RETURN
-
-
-
- /* --------------------------------------------------------- */
- /* Opens the about window */
- /* --------------------------------------------------------- */
-
- about: PROCEDURE expose srcdir portname
-
- window ID RSABWIN TITLE 'About...'
- group
- group HORIZ
- space HORIZ
- button PICT '"'srcdir'internals/author.iff"'
- space HORIZ
- endgroup
- view FILE '"'srcdir'internals/about.txt"'
- endgroup
- button PRESS COMMAND '"window ID RSABWIN close"' PORT portname LABEL "Ok"
- endwindow
-
- RETURN
-
-
-
- /* --------------------------------------------------------- */
- /* Only a testprocedure for testing new features */
- /* --------------------------------------------------------- */
-
- testprocedure: PROCEDURE expose srcdir portname
-
- parse arg listid ' ' mode
-
- RETURN
-